package com.sodao.dubbo.t6;

import java.util.concurrent.TimeUnit;

import org.apache.thrift.TException;


public class HelloServiceImpl implements HelloService.Iface {
	
	@Override
	public void sayHello(String str) throws TException {
		System.out.println("sayHello:" + str);
//		throw new NullPointerException("test nullpointer");
	}

	@Override
	public String getString(String str) throws TException {
//		if (str.equals("test")) {
			try {
				int t = Integer.parseInt(str.substring(Constants.TEXT.length()));
				System.out.println("-----------------------------" + t);
				TimeUnit.SECONDS.sleep(t);
			} catch (Exception e) {

			}
			return str;
//		} else {
//			String sub = str.substring(0, 5);
//			int i = Integer.parseInt(str.substring(5));
//			i = i + 1;
//			return sub + i;
//		}
//		return str;
	}

	@Override
	public User getUser(int id, String name, int age) throws Xception,
			TException {
		return new User(id, name, age);
	}
}
